﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Konstaller
{
   public class Row
    {

       //---  PRIVATE FIELD ----//
       int w = 20;
       int h = 20;
       int _x = 0;
       int _y = 0;

       ConsoleColor bg = ConsoleColor.Blue;
       ConsoleColor fnt = ConsoleColor.White;

       const char _topleft = '\u2554';
       const char _hline = '\u2550';
       const char _topright = '\u2557';
       const char _vline = '\u2551';
       const char _bleft = '\u255A';
       const char _bright = '\u255D';

       /// <summary>
       /// Set Width of Row
       /// </summary>
       public int Width
       {
           get { return w; }
           set { w = value; }
       }


       /// <summary>
       /// Set Height of Row
       /// </summary>
       public int Height
       {
           get { return h; }
           set { h = value; }
       }


       /// <summary>
       /// Get or Set Background Color
       /// </summary>
       public ConsoleColor BackgroundColor
       {
           get { return bg; }
           set { bg = value; }
       }


       /// <summary>
       /// Get or Set Font Color
       /// </summary>
       public ConsoleColor Foreground
       {
           get { return fnt; }
           set { fnt = value; }
       }


       /// <summary>
       /// Set X Poisition
       /// </summary>
       public int X
       {
           get { return _x; }
           set { _x = value; }
       }


       /// <summary>
       /// Set Y Position
       /// </summary>
       public int Y
       {
           get { return _y; }
           set { _y = value; }
       }



       /// <summary>
       /// Draw Function
       /// </summary>
       public void Draw()
       {
           Console.SetCursorPosition(X, Y);
           Console.BackgroundColor = BackgroundColor;
           Console.ForegroundColor = Foreground;

           //--  TRANCE 1 ---//

           Console.Write(_topleft);

           for (int i = 0; i < Width - 1; i++)
           {
               Console.Write(_hline);
           }

           Console.Write(_topright);

           //---- TRANCE 2 ----//

           for (int i = 1; i < Height; i++)
           {
               Console.SetCursorPosition(X, Y + i);
               Console.Write(_vline);

               Console.SetCursorPosition(X + Width, Y + i);
               Console.Write(_vline);
           }

           //------ TRANCE 3  ---------//


           Console.SetCursorPosition(X, Y + Height);
           Console.Write(_bleft);

           for (int i = 0; i < Width - 1; i++)
           {
               Console.Write(_hline);
           }

           Console.SetCursorPosition(X + Width, Y + Height);
           Console.Write(_bright);

       }

    }
}
